home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 20
/
Cream of the Crop 20 (Terry Blount) (1996).iso
/
os2
/
xdsn217.zip
/
DOC
/
samples.txt
< prev
next >
Wrap
Text File
|
1996-07-09
|
9KB
|
274 lines
SAMPLES.TXT Copyright (c) 1994,96 xTech Ltd
----------------------------------------------------------------
Native XDS-x86 OS/2 Edition
---------------------------
v2.17 (pre-release)
Sample Programs
We assume here, that XDS was properly installed, the working
directory was created and the 'xdssamp' script was invoked
(See readme.1st).
All examples in this text are provided for OS/2 edition.
See your readme.1st file for the information concerning
your distribution.
The "samples" directory contains the following subdirectories
and files:
simple - simple samples
dhry - dhrystone test (note: a single module dhrystone
test is placed to the "simple" directory)
See also "bench.txt".
nodes - an Oberon-2 example, illustrating usage
of Oberon run-time support.
mand - Mandelbrodt Set explorer for Presentation Manager.
Written in Modula-2.
cset - provides an example of mixed project, which
consists of Modula-2 and C units.
IBM's C compiler used.
watcom - provides an example of mixed project, which
consists of Modula-2 and C units.
WATCOM's C compiler used.
*.prj - XDS project files for samples .
samples\simple
--------------
All the samples on this directory consists of the only module.
Tests are written in Modula-2 and in Oberon-2. In these tests the
specific features of Oberon-2 are not used.
The following tests are provided:
hello.mod Hello, World (Modula-2)
hello.ob2 Hello, World (Oberon-2)
hisdemo.mod History demo (Modula-2) (See hisdemo.prj)
ackerman.ob2 Ackermann function (Oberon-2)
exp.ob2 Calculate exponent (Oberon-2)
exp.mod Calculate exponent (Modula-2)
self.ob2 Print self text (Oberon-2)
sieve.ob2 Prime numbers (Oberon-2)
sieve.mod Prime numbers (Modula-2)
fact.mod Factorial (Modula-2)
halt.mod Termination (Modula-2)
term.mod Termination (Modula-2)
except.mod Exceptions (Modula-2)
dry.mod Drystone benchmark (Modula-2)
(single module)
dry.c Drystone benchmark (C)
whet.mod Whetstone (Modula-2)
linnew.mod LinPack benchmark (Modula-2)
linnew.c LinPack benchmark (C)
The xc.red redirection file, that was created in your working
directory. already contains paths to the SIMPLE directory.
To get an executable program for a sample, invoke "xc" in the make
mode, passing a name of a sample module (w/o path). For example:
xc hello.mod =make
or
xc hello.ob2 =make
After that run the program:
hello
For "hisdemo" sample, use:
xc hisdemo.mod =make +genhistory
To see the stack of procedure calls ("execution history") use
his utility (C:\XDS\BIN\his.exe):
his
It searches for "errinfo.xds" file and appropriate map file to
produce the list of procedure calls. Every item of the list consists
of a source file name, a line number and optionaly a procedure name.
dry.c/dry.mod and linnew.c/linnew.mod are C and Modula-2 sources
of the same programs. Use them to compare the output code quality
of XDS and your C compiler(s).
samples\dhry
------------
The "dhry" directory contains two variants of well known Dhrystone
test:
puredhry.mod
timedhry.mod
Both tests imports "dry1" and "dry2" libraries.
To prepare executable use PROJECT operation mode. The redirection
file contains path to the project file "puredhry.prj".
xc =p puredhry
samples\findproc
----------------
This directory contains sources of a sample XDS IDE tool.
findproc.mod - Modula-2 source
readme.txt - tool setup instructions
Use the following command to build the executable
xc =p findproc
samples\nodes
-------------
The "nodes" subdirectory contains the following files, constituting
the Oberon-2 program:
Nodes.ob2 - definition of abstract Node class
Echo.ob2 - concrete Node extension
GenEcho.ob2 - concrete Node extension
Commands.ob2 - concrete Node extension
Types.ob2 - concrete Node extension
runme.ob2 - the top-level module
To build the program, type:
xc =p nodes.prj
The "Nodes" module defines an abstract object (Node). Objects of
this type are linked in the list. The module "Nodes" also
implement the command monitor ("Loop" procedure). The "Loop"
procedure reads an input from keyboard and then passes the input
to the current node, or if the input line starts from "."
executes some standard action.
The module "runme" imports modules defining the extensions of
type Node (concrete classes), inserts it in the list and then
call "Nodes.Loop".
Nodes.Node extensions:
----------------------
"Echo" - implements a node which prints its input to terminal.
"GenEcho" - if the number N is specified in the input line
creates "N" examples of the "Echo" Node.
"Commands" - provides facilities to call commands (exported
parameterless procedures) in the form:
ModuleName.ProcedureName
Also implements operations to enumerate all modules
in the program and all commands in the given module.
"Types" - provides facilities to allocate an object by the
given name in the form:
ModuleName.RecordTypeName
Modules "Types" and "Commands" illustrates the using of
meta-language facilities, including the command calls and
creating an object by its type name.
It is important to note, that the XDS does not support the
dynamic loading of the modules. You can use commands and types
from the modules which are already linked in the program.
samples\mand
------------
Mandelbrodt Set Explorer for Presentation Manager. The directory contains:
mand.mod - Modula-2 source text
mand.res - binary resource file
mand.exe - pre-built executable
readme.txt - short description
To build the executable file. issue the following commands
at the OS/2 command prompt:
xc =p mand
rc <xds directory>\samples\mand\mand.res mand.exe
Controls:
- press left mouse button to magnify image two times
(right button - four times )
- after the window size is changed, use the Refresh
command to update it
- use the Copy command to copy the current image
to the Clipboard
- use Back and Forward commands to review already
built images
samples\cset
------------
The directory contains:
cmain.c - main module of the program (C)
m2test.def - definition module
m2test.mod - implementation module
m2test.h - header file (manually written)
stdio.def - interface to <stdio.h>
cset.tem - template file
The sample shows how to write mixed project, i.e. projects written
partially in C and partially in Modula or Oberon. To compile
this test, the IBM's CSET should be properly installed.
For such a project the CSET library should be used.
To build the program, run:
xc cset =p
Take in attention that XDS compiler does not support _Optlink calling
conventions yet. So you can not call from Modula-2/Oberon-2 directly
those functions of standard CSET library which use such conventions.
To call _Optlink C function you must provide an intermediate C function
with _SysCall conventions.
samples\watcom
--------------
The directory contains: